Skip to content

[3.13] gh-159015: Fix test_math import on musl - #159016

Open
agners wants to merge 1 commit into
python:3.13from
agners:gh-159015-test-math-musl
Open

agners wants to merge 1 commit into
python:3.13from
agners:gh-159015-test-math-musl

Conversation

@agners

@agners agners commented Oct 8, 2026

Copy link
Copy Markdown

The 3.13 backport of gh-152563 (#155753) changed the skip condition of test_fma_zero_result to support.linked_to_musl() < (1, 2, 6). That works on main/3.14, where linked_to_musl() returns the musl version tuple (gh-90548). On 3.13 it still returns a bool, so on musl the condition raises TypeError while the class is being defined. test_math then fails to import, and test_cmath (which imports from it) fails too. This breaks --enable-optimizations builds of 3.13.16 on Alpine.

This PR restores the previous condition, so the test is skipped on musl again, as it was before 3.13.16. It's a 3.13-only fix; main and 3.14 are not affected.

cc @vstinner

🤖 Generated with Claude Code

The 3.13 backport of pythongh-152563 compares the return value of
support.linked_to_musl() with a version tuple, but on 3.13 the helper
still returns a bool. On musl this raises TypeError at class definition
time, so test_math and test_cmath fail to import. Restore the previous
skip condition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@python-cla-bot

python-cla-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app Bot added awaiting review tests Tests in the Lib/test dir labels Oct 8, 2026

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The issue #159015 prevents building Python with PGO on Alpine Linux, it's quite bad. IMO the issue is important enough to justify merging it in the 3.13 security-only branch.

@Yhg1s: Would you be ok to include this fix?

Currently, test_math fails this way on Alpine Linux:

~/python/3.13 # ./python -m test -v test_math 
...
test test_math crashed -- Traceback (most recent call last):
...
TypeError: '<' not supported between instances of 'bool' and 'tuple'

The only Alpine buildbot that we have didn't catch this major regression because it only runs on Python 3.14 and newer:

        cpw(
            name="ware-alpine",
            tags=['linux', 'unix', 'alpine', 'docker', 'amd64', 'x86-64', 'musl'],
            branches=BRANCHES.only_since(3, 14),
            parallel_tests=6,
        ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants